package com.poposchool.project.mapper;

import com.poposchool.project.entity.Menu;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MenuMapper {
    int deleteByPrimaryKey(Integer id);

    Menu selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Menu record);

    int updateByPrimaryKey(Menu record);

    @Insert("insert into sys_menu (name,path,page_path,icon,description,pid)\n" +
            "values (" +
            "       #{name}," +
            "       #{path}," +
            "       #{pagePath}," +
            "       #{icon}," +
            "       #{description}," +
            "       #{pId})")
    int insertMenu(Menu menu);

    List<Menu> getPageMenus(@Param("pageNum") Integer pageNum,
                            @Param("pageSize") Integer pageSize,
                            @Param("name") String name
    );

    @Select("select count(*) from sys_menu")
    Integer getAllNum();

    @Select("select * from sys_menu")
    List<Menu> findAll();
}